package com.sk.bilibili.apiMapper.bean;

import lombok.Data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author 邵康
 * @date 2021/7/11 18:48
 */
@Data
public class ClassHolder {

    private String name;
    private List<String> fields;
    private Map<String,ClassHolder> array;

    public ClassHolder(String name) {
        this.name=name;
        fields=new ArrayList<>();
        array=new HashMap<>();
    }

    public ClassHolder getClassHolder(String path, String name, List<ClassHolder> classHolders) {
        if(!array.containsKey(path)){
            ClassHolder classHolder = new ClassHolder(name);
            array.put(path, classHolder);
            classHolders.add(classHolder);
        }
        return array.get(path);
    }

    public void addField(String field) {
        fields.add(field);
    }

}
